function Discounter(min, max, discountPercentage) {
  this.min = min;
  this.max = max;
  this.discountPercentage = discountPercentage;
}

Discounter.prototype.isApplicable = function(order) {
    var itemsCount = order.items.length;

    return (itemsCount >= this.min && itemsCount < this.max)
};

Discounter.prototype.apply = function(order) {
    order.totalAmount = order.totalAmount - order.totalAmount * discountPercentage / 100;
};

var gadgetMixin = {
	gadget: {},
	addGadget: function(order) {
		order.items.push(this.gadget);
	}
};

var discounter = new Discounter(10, 20, 0);
var gadgetDiscounter = augment(discounter, gadgetMixin);

gadgetDiscounter.gadget = {name: "Fajny gadżet!"}


function augment(destination, source) {
  for (var methodName in source) {
    if (source.hasOwnProperty(methodName)) {
      destination[methodName] = source[methodName];
    }
  }
  return destination; 
}
